/*
 * Copyright 2007-2008 Michele Mostarda ( michele.mostarda@gmail.com ).
 * All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.asemantics.anthill;

import org.jivesoftware.smack.packet.Message;

import java.util.Map;

/**
 * This class models the result message of a remote invocation operation.
 *
 * @uthor Michele Mostarda
 */
public class InvokeCommandResponseMessage extends CommandResponseMessage {

    /**
     * Constructor.
     *
     * @param t
     * @param resultParameters
     * @param boxing
     */
    public InvokeCommandResponseMessage(final Throwable t, final Map<String,Object> resultParameters, boolean boxing) {
        super(Invoke.class, t, resultParameters, boxing);
    }

    /**
     * Constructor.
     *
     * @param map
     */
    public InvokeCommandResponseMessage(Map<String,Object> map) {
        super(Invoke.class, map, false);
    }

    /**
     * Returns a map containing the returned parameter values.
     *
     * @param message
     * @return a map of paramname / paramvalue string couples.
     * @throws IllegalArgumentException if the given message is not a <i>CommandResultMessage</i>.
     */
    public static Map<String,String> getReturnParameters(Message message) {
        return InvokeCommandMessage.extractParameters(message);
    }

}
